cmake_minimum_required(VERSION 3.17)
project(FirstExam)

set(CMAKE_CXX_STANDARD 14)

#设置OpenCV
set(OpenCV_DIR /usr/local)
find_package(OpenCV 3.4 REQUIRED)

#强迫症修复
set(OpenCV_LIBS ${OpenCV_LIBS})
set(OpenCV_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS})

#输出信息
message(STATUS "OpenCV library status:")
message(STATUS "    config: ${OpenCV_DIR}")
message(STATUS "    version: ${OpenCV_VERSION}")
message(STATUS "    libraries: ${OpenCV_LIBS}")
message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")

# 引入头文件
include_directories(${OpenCV_INCLUDE_DIRS})

add_executable(First First.cpp)
target_link_libraries(First ${OpenCV_LIBS})

add_executable(Second Second.cpp)
target_link_libraries(Second ${OpenCV_LIBS})

add_executable(Third Third.cpp)
target_link_libraries(Third ${OpenCV_LIBS})

# Find all *.cpp files and store in list mains
#file(GLOB_RECURSE Files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
#foreach(SourceFile IN LISTS Files)
#    # Get file name without directory
#    get_filename_component(FileName ${SourceFile} NAME_WE)
#    add_executable(${FileName} ${SourceFile})
#    target_link_libraries(${FileName} ${OpenCV_LIBS})
#endforeach()